package com.example.loginplaus;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class User extends AppCompatActivity {

    private TextView tv_user;
    private TextView tv_name;
    private TextView tv_age;
    private TextView tv_pwd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user);
        init();
        Intent intent = getIntent();
        if (intent.getStringExtra("name") != null) {
            String name = intent.getStringExtra("name");
            String age = intent.getStringExtra("age");
            String user = intent.getStringExtra("user");
            String pwd = intent.getStringExtra("pwd");
            tv_user.setText(user);
            tv_name.setText(name);
            tv_age.setText(age);
            tv_pwd.setText(pwd);
        }else {
            tv_user.setText("admin");
            tv_name.setText("张三");
            tv_age.setText("20");
            tv_pwd.setText("123456");
        }
    }

    public void init() {
        tv_user = findViewById(R.id.main_tv_user);
        tv_name = findViewById(R.id.main_tv_name);
        tv_age = findViewById(R.id.main_tv_age);
        tv_pwd = findViewById(R.id.main_tv_pwd);
    }

    public void End(View view) {
        startActivity(new Intent(this,MainActivity.class));
    }
}